package com.weishi.project.sport.home.controller;

import com.weishi.framework.web.controller.BaseController;
import com.weishi.framework.web.domain.AjaxResult;
import com.weishi.project.sport.home.service.SportHomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "运动员端--首页信息模块", description = "运动员端--首页信息模块")
@RestController
@CrossOrigin("*")//解决移动端跨域
@RequestMapping("/sportHome/")
public class HomeController extends BaseController {

    /**
     * 首页个人信息接口
     */
    @Autowired
    private SportHomeService sportHomeService;


    @ApiOperation("运动员 -- 获取首页个人信息")
    @RequestMapping(value = "getMineDate", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getMineDate()
    {
        return sportHomeService.getMineDate(currentLoginSportsman().getId());
    }


    @ApiOperation("运动员 -- 根据条件查询首页数据")
    @RequestMapping(value = "getMineHomeData", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getMineHomeData()
    {
        return sportHomeService.getMineHomeData();
    }


    @ApiOperation("运动员 -- 获取年度下拉数据")
    @RequestMapping(value = "getYear", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getYear()
    {
        return sportHomeService.getYear();
    }


    @ApiOperation("运动员 -- 本周训练数据")
    @RequestMapping(value = "getThisWeekTrainingData", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getThisWeekTrainingData(String day)
    {
        return sportHomeService.getThisWeekTrainingData(day);
    }


    @ApiOperation("运动员 -- 本周训练数据 -- 查询日期")
    @RequestMapping(value = "getQueryDate", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getQueryDate()
    {
        return sportHomeService.getQueryDate();
    }


    @ApiOperation("运动员 -- 根据训练分类查询总计")
    @RequestMapping(value = "getClassifiedTotal", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getClassifiedTotal(String day)
    {
        return sportHomeService.getClassifiedTotal(currentLoginSportsman().getId() , day);
    }


    @ApiOperation("运动员 -- 首页 --根据年查询各科训练时间占比")
    @RequestMapping(value = "getHomeTimeProportion", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getHomeTimeProportion(String years)
    {
        return sportHomeService.getHomeTimeProportion(currentLoginSportsman().getId() , years);
    }


    @ApiOperation("运动员 -- 首页 --根据年查询各科训练时间占比--月统计")
    @RequestMapping(value = "getHomeMonthlyStatistics", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getHomeMonthlyStatistics(String years)
    {
        return sportHomeService.getHomeMonthlyStatistics(currentLoginSportsman().getId() , years);
    }


    @ApiOperation("运动员 -- 水上专项成绩排名")
    @RequestMapping(value = "getThis", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getThis(Integer trainingMode , Integer kilometers , Integer realClassHour)
    {
        return sportHomeService.getThis(currentLoginSportsman().getSex() , trainingMode , kilometers , realClassHour);
    }


    @ApiOperation("运动员 -- 陆上专项成绩排名")
    @RequestMapping(value = "getThisOnLand", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getThisOnLand(Integer trainingMode , Integer kilometers , Integer realClassHour)
    {
        return sportHomeService.getThisOnLand(currentLoginSportsman().getSex() , trainingMode , kilometers ,realClassHour);
    }


    @ApiOperation("运动员 -- 首页 -- 水上专项滑行统计 Sum")
    @RequestMapping(value = "getWaterGlidingSum", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getWaterGlidingSum(String year ,Integer trainingMode)
    {
        return sportHomeService.getWaterGlidingSum(year , currentLoginSportsman().getId() , trainingMode);
    }


    @ApiOperation("运动员 -- 首页 -- 陆上专项滑行统计 Sum")
    @RequestMapping(value = "getLandGlidingSum", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getLandGlidingSum(String year ,Integer trainingMode)
    {
        return sportHomeService.getLandGlidingSum(year , currentLoginSportsman().getId() , trainingMode);
    }


    @ApiOperation("运动员 -- 首页 -- 专项滑行折线图")
    @RequestMapping(value = "getSpecialTaxiingLineChart", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getSpecialTaxiingLineChart(String year ,Integer trainingMode)
    {
        return sportHomeService.getSpecialTaxiingLineChart(year , currentLoginSportsman().getId() , trainingMode);
    }






}
